package com.filepd.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.filepd.entity.User;
import com.filepd.mapper.UserMapper;
import com.filepd.service.UserService;
import org.springframework.stereotype.Service;

/**
 * @author Atanycosts
 * @description 针对表【user(用户)】的数据库操作Service实现
 * @createDate 2023-03-06 15:52:59
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
        implements UserService {


    /**
     * 用户脱敏
     *
     * @param originUser
     * @return
     */
    @Override
    public User getSafetyUser(User originUser) {
        if (originUser == null) {
            return null;
        }
        User userDto = new User();
        userDto.setId(originUser.getId());
        userDto.setUserName(originUser.getUserName());
        userDto.setUserAccount(originUser.getUserAccount());
        userDto.setUserAvatar(originUser.getUserAvatar());
        userDto.setGender(originUser.getGender());
        userDto.setUserRole(originUser.getUserRole());
        userDto.setUserTags(originUser.getUserTags());
        return userDto;
    }
}




